package fr.contacts.controllers;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class ListController {

	@RequestMapping(value = "/list")
	public String list(Model model) {
		ContactsDAO.initialiseContactList();
		ContactsDAO.sortContactByName();
		model.addAttribute("contactList", ContactsDAO.readAllContact());
		return "WEB-INF/views/contacts.jsp";
	}
}
